/**
 * Created by sa on 2016/9/21.
 */

/*
var page = require('webpage').create();
page.open("http://wj.qq.com", function (status) {
  var title = page.evaluate(function () {
    return document.title;
  });
  console.log('Page title is ' + title);
  phantom.exit();
});

 */
var page = require('webpage').create();
//拦截log方法
page.onConsoleMessage = function (msg) {
   console.log("--onConsoleMessage");
  console.log('Page title is ' + msg);
};
page.open("http://wj.qq.com", function (status) {
  page.evaluate(function () {
   console.log("--evaluate start");
    console.log(document.title);
    console.log("--evaluate end");
  });
  phantom.exit();
});

/**
--onConsoleMessage
Page title is --evaluate start
--onConsoleMessage
Page title is 鑵捐闂嵎 - 鍏嶈垂濂界敤鐨勯棶鍗疯皟鏌ョ郴缁?璋冩煡闂嵎,鍏嶈垂,绠€鍗?妯℃澘
--onConsoleMessage
Page title is --evaluate end
**/
